Namespaces
Variants
Views
Actions

std::common_type(std::chrono::duration)

From cppreference.com
template <class Rep1, class Period1, class Rep2, class Period2>

struct common_type<std::chrono::duration<Rep1, Period1>,
                   std::chrono::duration<Rep2, Period2>> {
    typedef std::chrono::duration<
        typename std::common_type<Rep1, Rep2>::type, /*see note*/> type;

};
(since C++11)

Exposes the type named type, which is the common type of two std::chrono::durations.

[edit] Note

The period the resulting duration is the greatest common divisor of Period1 and Period2.

[edit] Example